﻿using System.Text;

namespace Wechat.Results
{
    /// <summary>
    /// 视频回复
    /// </summary>
    public class WechatVideoResult : WechatResult
    {
        public WechatVideoResult(string toUsername, string fromUsername)
            : base(toUsername, fromUsername)
        {

        }
        public string Title { get; set; }
        
        public string MediaId { get; set; }

        public string Description { get; set; }

        protected override void Format(StringBuilder builder)
        {
            builder.Append("<MsgType><![CDATA[video]]></MsgType>");
            builder.Append("<Video>");
            builder.AppendFormat("<MediaId><![CDATA[{0}]]></MediaId>", MediaId);
            if (!string.IsNullOrEmpty(Title)) { builder.AppendFormat("<Title><![CDATA[{0}]]></Title>", Title); }
            if (!string.IsNullOrEmpty(Description)) { builder.AppendFormat("<Description><![CDATA[{0}]]></Description>", Description); }
            builder.Append("</Video>");
        }
    }
}
